#ifndef PAGEDLER_H
#define PAGEDLER_H

#include <QMainWindow>

#include "../utils.h"

class QListWidget;
class QLabel;
class QPushButton;
class QListWidgetItem;

namespace Jcr
{
class ImagesWindow;
class ParamsWindow;
class VideoLinkWindow;
class PageDler : public QMainWindow
{
    Q_OBJECT
public:
    explicit PageDler(QWidget* parent = nullptr);

protected:
    QSize sizeHint() const;

private slots:
    void getModels();
    void onGetModelLinks(const StdStringMap& modelLinks);
    void onExec();
    void autoPilot(bool auto_);
    void onListItemDoubleClicked(QListWidgetItem* item);
    void onFinishedFetchingModelLinks();
    void onFinishedParseModelPage();
    void onFinishedParseParamsPage();
    void onFinishedSavingImages();
    void locateModelDir();

protected:
    void keyPressEvent(QKeyEvent* e);

private:
    bool modelExists(const QString& model);
    bool isModelDirEmpty(const QString& model);

private:
    bool m_isAutoPilot = false;

    QAction* m_startAct;
    QListWidget* m_modelList;
    QLabel* m_execLabel;
    QLabel* m_brandLabel;
    QLabel* m_gotImageLabel;
    QLabel* m_statusLabel;
    QLabel* m_leftCountLabel;
    QPushButton* m_execButton;
    QPushButton* m_autoPilotButton;
    QPushButton* m_locateButton;
    ImagesWindow* m_imagesWindow;
    ParamsWindow* m_paramsWindow;
    VideoLinkWindow* m_videoLinkWindow;
};

} // namespace jcr
#endif // PAGEDLER_H
